import { Result } from 'src/model/result';

export class ResultUtil {
    /**
     * 成功
     * @param data 
     * @returns 
     */
  static success(data: any): Result<any> {
    const result = new Result('200', 'success', data);
    return result;
  }
    /**
     * 错误
     * @param data 
     * @returns 
     */
  static error(data: any): Result<any> {
    return new Result('500', 'false', data);
  }
    /**
     * 自定义
     * @param code 
     * @param msg 
     * @param data 
     * @returns 
     */
  static customResult(code: string, msg: string, data: any): Result<any> {
    return new Result(code, msg, data);
  }
}
